package com.micro.school.order.controller;

import com.micro.school.common.core.utils.poi.ExcelUtil;
import com.micro.school.common.core.web.controller.BaseController;
import com.micro.school.common.core.web.domain.AjaxResult;
import com.micro.school.common.core.web.page.TableDataInfo;
import com.micro.school.common.log.annotation.Log;
import com.micro.school.common.log.enums.BusinessType;
import com.micro.school.order.entity.PayStandardFeeItemDetail;
import com.micro.school.order.service.IPayStandardFeeItemDetailService;
import com.micro.school.order.vo.PayStandardFeeItemDetailVo;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 标准收费项目管理明细Controller
 * 
 * @author lyb
 * @date 2025-08-14
 */
@RestController
@RequestMapping("/pay/payStandardFeeItemDetail")
public class PayStandardFeeItemDetailController extends BaseController
{
    @Autowired
    private IPayStandardFeeItemDetailService payStandardFeeItemDetailService;

    /**
     * 查询标准收费项目管理明细列表
     */
    @GetMapping("/list")
    public TableDataInfo list(PayStandardFeeItemDetail payStandardFeeItemDetail)
    {
        startPage();
        List<PayStandardFeeItemDetailVo> list = payStandardFeeItemDetailService.selectPayStandardFeeItemDetailList(payStandardFeeItemDetail);
        return getDataTable(list);
    }

    /**
     * 导出标准收费项目管理明细列表
     */
    @Log(title = "标准收费项目管理明细", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PayStandardFeeItemDetail payStandardFeeItemDetail)
    {
        List<PayStandardFeeItemDetailVo> list = payStandardFeeItemDetailService.selectPayStandardFeeItemDetailList(payStandardFeeItemDetail);
        ExcelUtil<PayStandardFeeItemDetailVo> util = new ExcelUtil<PayStandardFeeItemDetailVo>(PayStandardFeeItemDetailVo.class);
        util.exportExcel(response, list, "标准收费项目管理明细数据");
    }

    /**
     * 获取标准收费项目管理明细详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(payStandardFeeItemDetailService.selectPayStandardFeeItemDetailById(id));
    }

    /**
     * 新增标准收费项目管理明细
     */
    @Log(title = "标准收费项目管理明细", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PayStandardFeeItemDetail payStandardFeeItemDetail)
    {
        return toAjax(payStandardFeeItemDetailService.insertPayStandardFeeItemDetail(payStandardFeeItemDetail));
    }

    /**
     * 修改标准收费项目管理明细
     */
    @Log(title = "标准收费项目管理明细", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PayStandardFeeItemDetail payStandardFeeItemDetail)
    {
        return toAjax(payStandardFeeItemDetailService.updatePayStandardFeeItemDetail(payStandardFeeItemDetail));
    }

    /**
     * 删除标准收费项目管理明细
     */
    @Log(title = "标准收费项目管理明细", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(payStandardFeeItemDetailService.deletePayStandardFeeItemDetailByIds(ids));
    }
}
